package com.taorenqi.business.fragment.mine;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.taorenqi.business.R;
import com.taorenqi.business.event.StartFragmentEvent;
import com.taorenqi.business.fragment.base.BaseBackFragment;
import com.taorenqi.business.widget.statusview.StatusView;

import org.greenrobot.eventbus.EventBus;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;


/**
 * 充值管理
 * A simple {@link Fragment} subclass.
 */
public class RechargeManageFragment extends BaseBackFragment {


    @Bind(R.id.status_view)
    StatusView statusView;
    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.recharge_manage_record)
    TextView rechargeManageRecord;
    @Bind(R.id.recharge_manage_money_detail)
    TextView rechargeManageMoneyDetail;
    @Bind(R.id.recharge_manage_record_vip)
    TextView rechargeManageRecordVip;

    public static RechargeManageFragment newInstance() {
        // Required empty public constructor
        RechargeManageFragment fragment = new RechargeManageFragment();
        Bundle bundle = new Bundle();
        fragment.setArguments(bundle);
        return fragment;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_recharge_manage, container, false);
        ButterKnife.bind(this, view);
        initToolbar();
        return attachToSwipeBack(view);
    }

    private void initToolbar() {
        toolbar.setTitle("充值管理");
        initToolbarNav(toolbar);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @OnClick({R.id.recharge_manage_record, R.id.recharge_manage_money_detail,R.id.recharge_manage_record_vip})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.recharge_manage_record://gb充值记录
                EventBus.getDefault().post(new StartFragmentEvent(RechargeRecordFragment.newInstance()));
                break;
            case R.id.recharge_manage_record_vip://vip充值记录
                EventBus.getDefault().post(new StartFragmentEvent(RechargeRecordVipFragment.newInstance()));
                break;
            case R.id.recharge_manage_money_detail://资金明细
                EventBus.getDefault().post(new StartFragmentEvent(MoneyDetailFragment.newInstance()));
                break;
        }
    }

}
